Java: 9 by Andrew Binstock & Pankaj Kumar
Author:Andrew Binstock & Pankaj Kumar [Binstock, Andrew]
Language: eng
Format: azw3
Publisher: UNKNOWN
Published: 2018-11-24T16:00:00+00:00
Nashorn JavaScript Engine in JDK 9
Handy additions and support for ES6 make Nashorn even more useful.
Nashorn, the JDK’s built-in JavaScript engine, has undergone a variety of improvements in this new release. Before diving into those enhancements, let me briely set the
context for these changes so that their addition makes the most sense.
Background When I started the development of Nashorn in late 2010, I was just looking for a way to experiment with the newly minted invokedynamic (JSR 292) byte-code instruction. The JVM team later adopted Nashorn as a test bed forinvokedynamic, and the Nashorn Project drove much of the performance improvements made to theinvokedynamic implementation.
While this was going on, the Java group was discussing how JavaScript would likely grow to dominate client-side development and that integrating JavaScript with Java would be a critical element of the client/server equation. Rhino—an open source implementation of JavaScript from the Mozilla Foundation that was then the JDK ofering for JavaScript— was getting long in the tooth, and further development was winding down. In November 2012, JDK Enhancement Proposal (JEP) 174, “Nashorn JavaScript Engine,” was approved, which enabled work to begin in earnest to provide a fresh, robust, secure, full-featured implementation of ECMAScript-262 Edition 5.1 (ES5) to run on the Java platform.
Initially, Nashorn found a home in a wide variety of applications, such as app servers, JavaFX applications, utilities, shell scripts, embedded systems, and so on.
Nashorn continues to have broad usage, but its use
appears to have settled into three main areas:
■ The development of JavaScript applications that can be
run on both the client and the server. In the JavaScript
world, this is known as isomorphic development. The advantages are huge for smaller shops that want to build front ends for both desktop and mobile services—a single programming language with a common codebase and rapid delivery. Isomorphic development also scales well for
larger systems.
■ Runtime adaptive or dynamic coding. The term I like to use is soft coding, where portions of an application can be modiied after the application/server is deployed. This capability is used for everything from stored procedures in databases to application coniguration management.
■ Shell scripting. This consists of using JavaScript in areas where bash or Python would traditionally be used.
There is often a lot of debate about Nashorn’s performance on
the JVM compared to native JavaScript performance on platforms such as Google’s V8. Nashorn starts out slower because
it translates the JavaScript to bytecode. After that, Nashorn is
at the mercy of HotSpot to deliver native code. This approach
works well for long-running server applications but not as
well for small and run-once scripts. The main reason we
developed Nashorn in the irst place was to run JavaScript
and Java together seamlessly. Most Nashorn applications do a
great job of orchestrating JavaScript and Java, something that
V8 was not designed to do. 34
ES6 Support The most important issue for JavaScript developers doing isomorphic development is the need to have client/server source code compatibility. With most browsers adopting ECMAScript 6 (ES6) as the standard level of language support for JavaScript, it was essential to bring Nashorn in line.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27093)
Hello! Python by Anthony Briggs(25941)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25283)
Kotlin in Action by Dmitry Jemerov(24393)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23590)
Dependency Injection in .NET by Mark Seemann(23311)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21942)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20847)
Grails in Action by Glen Smith Peter Ledbrook(19869)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17072)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16832)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14464)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12581)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11865)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10650)
Hit Refresh by Satya Nadella(9236)
The Kubernetes Operator Framework Book by Michael Dame(8585)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8443)
Robo-Advisor with Python by Aki Ranin(8386)